import { defineStore } from 'pinia'
export const useCustomersStore = defineStore('customers', {
  state: () => ({
   userid:"",
   token:"",
   id:0
  }),
  //相当于计算属性
  // getters: {
  //   getFullName: (state) => {
  //     return 'hello' + state.name;
  //   },
  // },
  actions: {
    SET_USER(userid:string,token:string,id:number){
      this.userid=userid;
      this.token=token;
      this.id=id
    }
  },
  persist: {
    key: "pinia-customer",//本地存储的数据的key名字
    storage: localStorage,  // sessionStorage是另一种存储方式
    paths: ['userid', 'token','id']
  }
})